package cn.imnaer.service.rpc.scenic.process;

import cn.imnaer.service.persistence.model.ScenicContribution;
import cn.imnaer.service.persistence.model.consts.SCENIC;
import cn.imnaer.service.persistence.model.consts.SCENICCONTRIBUTION;
import cn.imnaer.service.rpc.common.AbstractRepository;
import cn.imnaer.service.rpc.scenic.dao.ScenicContributionDaoImpl;

import org.bson.BSONObject;
import org.bson.BasicBSONObject;

import java.util.List;

public class ScenicCommentService {
	private ScenicContributionDaoImpl scenicCommentDaoImpl = ScenicContributionDaoImpl.getInstance();

	public String getFirstCommentUserId(String scenicId) {
		BSONObject matcher = new BasicBSONObject();
		matcher.put(SCENIC.scenicId, scenicId);
		BSONObject orderBy = new BasicBSONObject();
		orderBy.put(SCENICCONTRIBUTION.createTime, -1);
		ScenicContribution record = this.scenicCommentDaoImpl.findOne(matcher, orderBy);
		if (record != null) {
			return record.getUserId();
		} else {
			return null;
		}
	}

	

	

}
